package com.atguigu.atcrowdfunding.service.impl;

import com.atguigu.atcrowdfunding.bean.Permission;
import com.atguigu.atcrowdfunding.bean.User;
import com.atguigu.atcrowdfunding.dao.PermissionDao;
import com.atguigu.atcrowdfunding.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * lcd  2020/4/1
 * Description:
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionDao permissionDao;

    @Override
    public List<Permission> findPermissionsByPid(int pid) {
        return permissionDao.findPermissionByPid(pid);
    }

    @Override
    public List<Permission> findAll() {
        return permissionDao.findAll();
    }

    @Override
    public void insert(Permission permission) {
        permissionDao.insert(permission);
    }

    @Override
    public Permission findById(Integer id) {
        return permissionDao.findById(id);
    }

    @Override
    public void update(Permission permission) {
        permissionDao.update(permission);
    }

    @Override
    public void delete(Integer id) {
        permissionDao.delete(id);
    }

    @Override
    public List<Integer> findPermissionsByRoleId(Integer roleid) {
        return permissionDao.findPermissionsByRoleId(roleid);
    }

    @Override
    public List<Permission> findPermissionsByUser(User dbUser) {
        return permissionDao.findPermissionsByUser(dbUser);
    }
}
